<?php
namespace app\api\validate;

use think\Validate;

class DevideConfigValidate extends Validate
{
    protected $rule =   [
        'device_code'  => 'require',
        'mac'  => 'require',
        'device_sn'  => 'require',
        'device_id'  => 'require',
        'brand_name'  => 'require',
        'model'  => 'require',
        'updated_at'=> 'require',
        'school_id'=> 'require',
        'teacher_id'=> 'require',
        'event_id'=> 'require',
        'student_id'=> 'require',
        'grade_id'=> 'require',
        'class_id'=> 'require',
        'card_number'=> 'require',
        'content'=>'require',
        'province'=>'require',
        'city'=>'require',
    ];
    
    protected $message  =   [
        'device_code.require' => 'device_code必须填写',
        'mac.require' => 'mac必须填写',
        'device_id.require' => 'device_id必须填写',
        'device_sn.require' => 'device_sn必须填写',
        'brand_name.require' => 'brand_name必须填写',
        'model.require' => 'model必须填写',
        'updated_at.require' => 'updated_at必须填写',
        'school_id.require' => 'school_id 学校id必须填写',
        'teacher_id.require' => 'teacher_id 老师id必须填写',
        'event_id.require' => 'event_id 事件id必须填写',
        'student_id.require' => 'student_id 学生id必须填写',
        'grade_id.require' => 'grade_id 年级id必须填写',
        'class_id.require' => 'class_id 班级id必须填写',
        'card_number.require' => 'card_number 学生卡号必须填写',
        'content'=>'content必须填写',
        'province'=>'province 省必须填写',
        'city'=>'city城市必须填写'
    ];
    
    protected $scene = [
        'view'  =>  ['device_code'],
        'deviceCode' =>['mac','device_sn','brand_name','model'],
        'deviceActive' =>['device_code','mac','device_sn','brand_name','model'],
        'webInfo'=>['device_code','device_id'],
        'updated' =>['device_code','updated_at'],
        'attendance'=>['school_id','event_id','teacher_id'],
        'stu_attendance'=>['event_id','student_id','class_id'],
        'curr_attendance'=>['event_id','student_id','device_code'],
        'card_student'=>['card_number','card_student'],
        'card_teacher'=>['card_number','device_code'],
        'socket'=>['class_id','content'],
        'weacher'=>['province','city']
    ];
}
